<?php

namespace app\admin\controller;

use app\admin\service\IllegalService;
use think\Request;

class Illegal extends Backend
{
    /**
     * @var IllegalService
     */
    protected $service;

    protected function initialize()
    {
        parent::initialize();
        $this->service = new IllegalService();
    }

    public function getList(Request $request)
    {
        $data = $this->service->lists($request->param());
        $this->jsonReturn($data);
    }

    public function setShow(Request $request)
    {
        $res = $this->service->setShow($request->param('id'));
        $this->jsonReturn($res);
    }

    public function submitMark(Request $request)
    {
        $images = $request->param('images');
        if(is_array($images)){
            $image = $images[1];
        }
        $res = $this->service->submitMark($image,$request->param('points'));
        $this->jsonReturn($res);
    }

    public function compareImg(Request $request)
    {
        $res = $this->service->compareImg();
        $this->jsonReturn($res);
    }

    public function getLastImageByAddress(Request $request)
    {
        $address = $request->param('address');
        $res = $this->service->getLastImageByAddress($address);
        $this->jsonReturn($res);

    }
}
